import { defineStore } from 'pinia';
export const userCanvasStore = defineStore({//需要注意的是，defineStore返回的是一个回调方法
    id: 'canvas',//test是该状态管理的唯一标志也可以使用defineStore(id,{});的形式
    state() {
        return {
            canvasInfo: {
                x: 1070,
                y: 615
            }
        }
    },
})

export const userToolbarStore = defineStore({
    id: "canvas_edit",
    state() {
        return {
            componentsList: [],
            componentsData: [
                {
                    component: 'drag-text',
                    label: "文字",
                    propLable: '双击编辑文字',
                    icon: "<el-icon><Edit /></el-icon>",
                    style: {
                        top: 0,
                        left: 0
                    }
                },
                {
                    component: 'drag-button',
                    label: "按钮",
                    propLable: '按钮',
                    icon: "<el-icon><TurnOff /></el-icon>",
                    style: {
                        top: 0,
                        left: 0
                    }
                },
                {
                    component: 'drag-rect',
                    label: "矩形",
                    propLable: '矩形',
                    icon: "<el-icon><Crop /></el-icon>",
                    style: {
                        top: 0,
                        left: 0
                    }
                },
                {
                    component: 'drag-echart',
                    label: "echat图表",
                    propLable: 'echart',
                    icon: "<el-icon><Crop /></el-icon>",
                    style: {
                        top: 0,
                        left: 0
                    }
                }
            ]
        }
    },
    actions: {
        addItemCom(item:any) {
            this.componentsList.push(item)
        },
        changeToolItem() {

        }
    }
})